angular.module(moduleName + '.directives')
  .directive('hrTab',function(){
    return{
      restrict:'E',
      templateUrl:'component/directive/hr-tab/hr-tab.html',
      transclude: true,
      replace: true,
      scope:{
        top:'@',//顶部距离
        tab:'=',
        tabContent:'=?tabContent'
      },
      // controller:function($scope){
      //   console.log($scope.value);
      // },
      link:function(scope){
        scope.tabContent = 0;
        scope.changeClass = function(index){
          for(i in scope.tab){
            if(i == index){
              scope.tab[index].flag = true;
            }else{
              scope.tab[i].flag = false;
            }
          };
          //tab 内容切换
          switch(index){
            case 0:
              scope.tabContent = 0;
              break;
            case 1 :
              scope.tabContent = 1;
              break;
            case 2:
              scope.tabContent = 2;
              break;
            case 3:
              scope.tabContent = 3;
              break;
          }
        };
      }
    };
  });
